<?php 

class Inventario_model extends CI_Model{ 
	private $_tabla = 'Inventario';
	public $idLibro = 0;
    public $idCatalogo = 0;
    public $nroEstanteria = "";
    public $prestado = 0;
    public $ejemplarConsulta = 0;
    public $ingreso = 0;
    public $notas = "";
    public $fechaAgregado = 0;

    public function getAll(){
    	return $this->db->get($this->_tabla)->result_array();
    }
    public function insert(){
    	$this->db->insert($this->_tabla,$this);
    }

    public function update(){
		$this->db->where('idLibro', $this->idLibro);
		//$this->db->where('idCatalogo',$this->idCatalogo);
		// los dos WHERE producen : WHERE idLibro = 'idLibro' AND idCatalogo = 'idCatalogo'
		$this->db->update($this->_tabla,$this);
	}
	public function getById($id,$id2){
	$query = $this->db->query("SELECT * FROM " . $this->_tabla . " WHERE idLibro = '" . $id . "'".
		"AND idCatalogo = '".$id2."'");

	 foreach ($query->result() as $row)
	 {
		return $row;
	 }
    }


}


  ?>



